import  testRoutes  from "./test/test_routes_index";
import Index from "@/views/views_index.vue";

import { RouteRecordRaw, createRouter, createWebHistory } from "vue-router";
import Home from "@/views/home/home_index.vue";
import {menuTestRoutes} from '@/components/menu/demo/menu_test_routes'

let routes: RouteRecordRaw[] = [
    {
        name: "index",
        path: "/",
        component: Index,
        meta: {
            title: "首页",
        },
        redirect: "/home",
        children: [
            {
                name: "home",
                path: "/home",
                component: Home,
                meta: {
                    title: "首页",
                },
            },
        ],
    },
    ...menuTestRoutes
];

routes=routes.concat(testRoutes);

console.log('in routes index: routers ',routes);

const router = createRouter({
    history: createWebHistory(),
    routes,
    scrollBehavior: () => ({ left: 0, top: 0 }),
});

export {router};

// export { componentTestRoutes };

// router.afterEach((to, _from) => {
//     if (to.meta.title) {
//         setRouteTitle(to.meta.title as string);
//     }
// });